package com.offline.module.user.service.impl;

import com.offdissys.common.core.constant.ResultEnum;
import com.offdissys.common.core.lang.Assert;
import com.offline.module.user.dao.user.UserMapper;
import com.offline.module.user.entity.user.UserInfo;
import com.offline.module.user.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ZhangHaiWen
 * @title: UserInfoServiceImpl
 * @projectName offline-discount-sys
 * @description: TODO
 * @date 2022/3/2120:26
 */
@Service(value = "userInfoService")
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public UserInfo create(UserInfo userInfo) {
        int insert = userMapper.insert(userInfo);
        Assert.isTrue(insert>0, ResultEnum.SYS_ERROR);
        return userMapper._selectById(userInfo.getId());
    }

    @Override
    public UserInfo selectById(int id) {
        return userMapper._selectById(id);
    }
}
